package com.lottery.htbc.service;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lottery.htbc.dao.SynchroRecordDao;
import com.lottery.htbc.pojo.SynRecord;

@Service
public class LuckDrawServiceImpl {

	@Autowired
	private SynchroRecordDao synchroRecordDao;

	/*
	 * 添加等待同步的记录
	 */
	public void saveWaitSynRecord(Map<String, Object> synMap){
		SynRecord synRecord=new SynRecord();
		if(synMap.get("betType")!=null){
			synRecord.setBetType(synMap.get("betType").toString());
		}
		if(synMap.get("roundId")!=null){
			synRecord.setRoundId(synMap.get("roundId").toString());
		}
		if(synMap.get("roundNo")!=null){
			synRecord.setRoundNo(synMap.get("roundNo").toString());
		}
		if(synMap.get("userId")!=null){
			synRecord.setUserId(Integer.valueOf(synMap.get("userId").toString()));
		}
		if(synMap.get("userId")!=null){
			synRecord.setSynToken(synMap.get("synToken").toString());
		}
		if(synMap.get("taskId")!=null){
			synRecord.setTaskId(synMap.get("taskId").toString());
		}
		if(synMap.get("account")!=null){
			synRecord.setAccount(synMap.get("account").toString());
		}
		if(synMap.get("throwAmount")!=null){
			synRecord.setThrowAmount(Float.valueOf(synMap.get("throwAmount").toString())/100);
		}
		if(synMap.get("bsIndex")!=null){
			synRecord.setBsIndex(synMap.get("bsIndex").toString());
		}
		
		synchroRecordDao.save(synRecord);
	}

}
